package com.hackerrank.challenges.trignometricratios;

import java.util.Scanner;public class Solution{public static void main(String[] args){Scanner in=new Scanner(System.in);int N=in.nextInt(),i=0,j;for(;i<N;i++){double x=in.nextDouble(),s=0,c=1,t=1;for(j=1;j<=9;j++){if(j%2==1){t*=x/j;s+=t;}else{t*=-x/j;c+=t;}}System.out.println(Math.round(s*1000)/1000.0+"\n"+Math.round(c*1000)/1000.0);}}}
